package TwT2;

public class Computer {

    private CPU cpu;
    private Memory memory;
    private HDD hdd;
    private Mainboard mainboard;
    private String Name;
    private double price;

    public Computer(String name,CPU cpu,Memory memory,HDD hdd,Mainboard mainboard){
        this.Name = name;
        this.cpu = cpu;
        this.memory = memory;
        this.hdd = hdd;
        this.mainboard = mainboard;
        this.price = cpu.getPrice() + memory.getPrice() + hdd.getPrice() + mainboard.getPrice();
    }

    public void Display(){
        System.out.println("Name:" + this.Name);
        System.out.println("Price:" + this.price);
        System.out.println("--------------------");
        cpu.Display();
        cpu.work();
        System.out.println("--------------------");
        memory.Display();
        cpu.work();
        System.out.println("--------------------");
        hdd.Display();
        hdd.work();
        System.out.println("--------------------");
        mainboard.Display();
        mainboard.work();
        System.out.println("--------------------");
    }

    public void work(){
        System.out.println(this.Name + "+work");
    }

}
